package com.csdn.actuator;

import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class ActuatorHolder {
    private Map<String, Actuator> actuatorMap = new HashMap<>();

    public ActuatorHolder(List<Actuator> actuatorList) {
        for (Actuator actuator : actuatorList) {
            actuatorMap.putIfAbsent(actuator.getType(), actuator);
        }
    }
    public Actuator getActuator(String type) {
        return actuatorMap.get(type);
    }
}
